<template>
  <span>
    <template v-for="item in options">
      <template v-if="values.includes(item.value)">
        <u-tag :text="item.text" type="primary" size="mini" />
      </template>
    </template>
  </span>
</template>

<script>
export default {
  name: 'DictTag',
  props: {
    options: {
      type: Array,
      default: null,
    },
    value: [Number, String, Array],
  },
  computed: {
    values() {
      if (this.value !== null && typeof this.value !== 'undefined') {
        return Array.isArray(this.value) ? this.value : [String(this.value)]
      } else {
        return []
      }
    },
  },
}
</script>